package com.ktgj.common.core.utils.xml;

import java.util.List;
import java.util.ArrayList;
import java.util.stream.Collectors;

public class XElementCollection extends ArrayList<XElement>
{

	private static final long serialVersionUID = 8081352310697526451L;

	public XElement element(String name)
	{
		for (XElement e : this)
		{
			if (e.getName().equals(name))
			{
				return e;
			}
		}

		return null;
	}

	public List<XElement> elements(String name)
	{
		return this.stream().filter(x -> x.getName().equals(name)).collect(Collectors.toList());
	}
}
